const BaseController = require("./base");

class UserStudyDayController extends BaseController {
  // 记录用户学习天数
  async recordStudyDay() {
    const { ctx } = this;
    const user_id = ctx.state.user.user_id;
    const result = await ctx.service.userStudyDay.recordStudyDay(user_id);
    this.success(result);
  }

  // 获取用户的学习天数
  async getStudyDays() {
    const { ctx } = this;
    const user_id = ctx.state.user.user_id;
    const studyDays = await ctx.service.userStudyDay.getStudyDays(user_id);
    this.success(studyDays);
  }
  // 获取用户的学习总天数
  async getStudyTotalDays() {
    const { ctx } = this;
    const user_id = ctx.state.user.user_id;
    const total = await ctx.service.userStudyDay.getTotalStudyDays(user_id);
    this.success(total);
  }
}

module.exports = UserStudyDayController;